//引入二次封装的axios文件
import request from '@/utils/request'

//获取spu商品详细列表
///admin/product/{page}/{limit}
export const reqSkuList = (page,limit,category3Id) => request({url:`/admin/product/${page}/${limit}`,method:'get',params:{category3Id}})

//获取spu信息
// /admin/product/getSpuById/{spuId}
export const reqSpuInfo = (spuId) => request({url:`/admin/product/getSpuById/${spuId}`,method:'get'})

//获取品牌信息接口

// /admin/product/baseTrademark/getTrademarkList
export const reqTrademarkList = ()=>request({url:'/admin/product/baseTrademark/getTrademarkList',method:'get'})

//获取商品图片
// /admin/product/spuImageList/{spuId}
export const reqSpuImageList = (spuId)=>request({url:`/admin/product/spuImageList/${spuId}`,method:'get'})

//获取Spu详细接口
// /admin/product/baseSaleAttrList
export const reqBaseAttrList = ()=>request({url:'/admin/product/baseSaleAttrList',method:'get'})

//修改或者添加按钮
// 修改 /admin/product/updateSpuInfo
// 添加 /admin/product/saveSpuInfo
export const reqAddOrUpdate = (spuInfo)=>{
    //如果有id的话，那就是修改，没有id的话，就是添加
    if(spuInfo.id) {
        return request({url:'/admin/product/updateSpuInfo',method:'post',data:spuInfo})
    }else {
        return request({url:'/admin/product/saveSpuInfo',method:'post',data:spuInfo})
    }
}

//删除商品列表的接口
// /admin/product/deleteSpu/{spuId}
export const reqDeleteList = (spuId)=>request({url:`/admin/product/deleteSpu/${spuId}`,method:'delete'})

//获取图片链接
// /admin/product/spuImageList/{spuId}
export const reqGetImageList = (spuId) => request({url:`/admin/product/spuImageList/${spuId}`,method:'get'})

//获取销售属性数据
// /admin/product/spuSaleAttrList/{spuId}
export const reqspuSaleAttrList = (spuId)=>request({url:`/admin/product/spuSaleAttrList/${spuId}`,method:'get'})

//获取平台属性数据
//  /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
export const reqAttrInfoList = (category1Id,category2Id,category3Id) => request({url:`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,method:'get'})

//添加sku信息
// /admin/product/saveSkuInfo
export const reqAddskuInfo = (skuInfo)=>request({url:'/admin/product/saveSkuInfo',method:'post',data:skuInfo})

//显示spu列表信息
// /admin/product/findBySpuId/{spuId}
export const reqSkuListNone = (spuId) => request({url:`/admin/product/findBySpuId/${spuId}`,method:'get'})